package com.livestocksolutions;

import java.util.Date;

/* -- Version History --
 *  1.0 : 22 July 2012 - Initial version.
 *  
 *  1.1 : 22 July 2012 - changed amount from int to double
 */

/**
 * This class stores a monetary transaction that have occurred in relation to Bovines
 * @author Adam Parr
 * @version 1.1
 * 
 * @.modified 22 July 2012
 */
public class Transaction {
	/**
	 * A unique id that will be used to identify this Transaction.
	 */
	private int transactionID;
	/**
	 * The amount this transaction in either expenditure (any negative value bellow 0.00), or income (any positive value above 0.00)
	 */
	private double amount;
	/**
	 * The date of this transaction
	 */
	private Date date;

	/**
	 * Creates a new Transaction
	 * @param transactionID A unique number to identify this Transaction
	 * @param amount the amount this transaction in either expenditure (any negative value bellow 0.00), or income (any positive value above 0.00)
	 * @param date the date of this transaction
	 */
	public Transaction(int transactionID, double amount, Date date){
		this.transactionID=transactionID;
		this.amount=amount;
		this.date=date;
	}
	
	/**
	 * Get the unique transaction ID of this Transaction
	 * @return The unique transaction ID
	 */
	public int getTransactionID() {
		return transactionID;
	}
	
	/**
	 * Set the unique transaction ID of this Transaction
	 * @param transactionID The unique transaction ID for this Transaction
	 */
	public void setTransactionID(int transactionID) {
		this.transactionID=transactionID;
	}
	
	/**
	 * Get the income/expenditure of this Transaction
	 * @return The income/expenditure
	 */
	public double getAmount(){
		return amount;
	}
	
	/**
	 * Set the income/expenditure of this Transaction
	 * @param amount The income/expenditure of this Transaction
	 */
	public void setAmount(double amount){
		this.amount=amount;
	}
	
	/**
	 * Get the date of this Transaction
	 * @return The date of this Transaction
	 */
	public Date getDate(){
		return date;
	}
	
	/**
	 * Set the date of this Transaction
	 * @param date The date of this Transaction
	 */
	public void setDate(Date date){
		this.date=date;
	}
	
	/**
	 * Returns a String representation of this Transaction
	 * @return A String representation of this Transaction
	 * @.TODO Determine the format of the String to return
	 */
	@Override
	public String toString(){
		return "Transaction: "+transactionID+" Date: "+date+" "+(amount>0.0?"Income":"Expenditure")+" $"+amount;
	}
}
